home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / print / ServiceDialog$CopiesPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  4.6 KB  |  140 lines

  1. package sun.print;
  2.  
  3. import java.awt.GridBagConstraints;
  4. import java.awt.GridBagLayout;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import javax.print.DocFlavor;
  8. import javax.print.attribute.AttributeSet;
  9. import javax.print.attribute.standard.Copies;
  10. import javax.print.attribute.standard.CopiesSupported;
  11. import javax.print.attribute.standard.SheetCollate;
  12. import javax.swing.BorderFactory;
  13. import javax.swing.JCheckBox;
  14. import javax.swing.JLabel;
  15. import javax.swing.JPanel;
  16. import javax.swing.JSpinner;
  17. import javax.swing.SpinnerNumberModel;
  18. import javax.swing.event.ChangeEvent;
  19. import javax.swing.event.ChangeListener;
  20.  
  21. class ServiceDialog$CopiesPanel extends JPanel implements ActionListener, ChangeListener {
  22.    private final String strTitle;
  23.    private SpinnerNumberModel snModel;
  24.    private JSpinner spinCopies;
  25.    private JLabel lblCopies;
  26.    private JCheckBox cbCollate;
  27.    private boolean scSupported;
  28.    // $FF: synthetic field
  29.    final ServiceDialog this$0;
  30.  
  31.    public ServiceDialog$CopiesPanel(ServiceDialog var1) {
  32.       this.this$0 = var1;
  33.       this.strTitle = ServiceDialog.getMsg("border.copies");
  34.       GridBagLayout var2 = new GridBagLayout();
  35.       GridBagConstraints var3 = new GridBagConstraints();
  36.       this.setLayout(var2);
  37.       this.setBorder(BorderFactory.createTitledBorder(this.strTitle));
  38.       var3.fill = 2;
  39.       var3.insets = ServiceDialog.access$700();
  40.       this.lblCopies = new JLabel(ServiceDialog.getMsg("label.numcopies"), 11);
  41.       this.lblCopies.setDisplayedMnemonic(ServiceDialog.access$800("label.numcopies"));
  42.       this.lblCopies.getAccessibleContext().setAccessibleName(ServiceDialog.getMsg("label.numcopies"));
  43.       ServiceDialog.access$300(this.lblCopies, this, var2, var3);
  44.       this.snModel = new SpinnerNumberModel(1, 1, 999, 1);
  45.       this.spinCopies = new JSpinner(this.snModel);
  46.       this.lblCopies.setLabelFor(this.spinCopies);
  47.       ((JSpinner.NumberEditor)this.spinCopies.getEditor()).getTextField().setColumns(3);
  48.       this.spinCopies.addChangeListener(this);
  49.       var3.gridwidth = 0;
  50.       ServiceDialog.access$300(this.spinCopies, this, var2, var3);
  51.       this.cbCollate = ServiceDialog.access$1000("checkbox.collate", this);
  52.       this.cbCollate.setEnabled(false);
  53.       ServiceDialog.access$300(this.cbCollate, this, var2, var3);
  54.    }
  55.  
  56.    public void actionPerformed(ActionEvent var1) {
  57.       if (this.cbCollate.isSelected()) {
  58.          ServiceDialog.access$1200(this.this$0).add(SheetCollate.COLLATED);
  59.       } else {
  60.          ServiceDialog.access$1200(this.this$0).add(SheetCollate.UNCOLLATED);
  61.       }
  62.  
  63.    }
  64.  
  65.    public void stateChanged(ChangeEvent var1) {
  66.       this.updateCollateCB();
  67.       ServiceDialog.access$1200(this.this$0).add(new Copies(this.snModel.getNumber().intValue()));
  68.    }
  69.  
  70.    private void updateCollateCB() {
  71.       int var1 = this.snModel.getNumber().intValue();
  72.       if (ServiceDialog.access$1500(this.this$0)) {
  73.          this.cbCollate.setEnabled(true);
  74.       } else {
  75.          this.cbCollate.setEnabled(var1 > 1 && this.scSupported);
  76.       }
  77.  
  78.    }
  79.  
  80.    public void updateInfo() {
  81.       Class var1 = Copies.class;
  82.       Class var2 = CopiesSupported.class;
  83.       Class var3 = SheetCollate.class;
  84.       boolean var4 = false;
  85.       this.scSupported = false;
  86.       if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var1)) {
  87.          var4 = true;
  88.       }
  89.  
  90.       CopiesSupported var5 = (CopiesSupported)ServiceDialog.access$400(this.this$0).getSupportedAttributeValues(var1, (DocFlavor)null, (AttributeSet)null);
  91.       if (var5 == null) {
  92.          var5 = new CopiesSupported(1, 999);
  93.       }
  94.  
  95.       Copies var6 = (Copies)ServiceDialog.access$1200(this.this$0).get(var1);
  96.       if (var6 == null) {
  97.          var6 = (Copies)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var1);
  98.          if (var6 == null) {
  99.             var6 = new Copies(1);
  100.          }
  101.       }
  102.  
  103.       this.spinCopies.setEnabled(var4);
  104.       this.lblCopies.setEnabled(var4);
  105.       int[][] var7 = var5.getMembers();
  106.       int var8;
  107.       int var9;
  108.       if (var7.length > 0 && var7[0].length > 0) {
  109.          var8 = var7[0][0];
  110.          var9 = var7[0][1];
  111.       } else {
  112.          var8 = 1;
  113.          var9 = Integer.MAX_VALUE;
  114.       }
  115.  
  116.       this.snModel.setMinimum(new Integer(var8));
  117.       this.snModel.setMaximum(new Integer(var9));
  118.       int var10 = var6.getValue();
  119.       if (var10 < var8 || var10 > var9) {
  120.          var10 = var8;
  121.       }
  122.  
  123.       this.snModel.setValue(new Integer(var10));
  124.       if (ServiceDialog.access$400(this.this$0).isAttributeCategorySupported(var3)) {
  125.          this.scSupported = true;
  126.       }
  127.  
  128.       SheetCollate var11 = (SheetCollate)ServiceDialog.access$1200(this.this$0).get(var3);
  129.       if (var11 == null) {
  130.          var11 = (SheetCollate)ServiceDialog.access$400(this.this$0).getDefaultAttributeValue(var3);
  131.          if (var11 == null) {
  132.             var11 = SheetCollate.UNCOLLATED;
  133.          }
  134.       }
  135.  
  136.       this.cbCollate.setSelected(var11 == SheetCollate.COLLATED);
  137.       this.updateCollateCB();
  138.    }
  139. }
  140.